# post
# 1 找数据（确认需要获取的数据）
# 2 确认数据是否在网页源代码里面
# 3 数据不在网页源代码里面
# 4 通过抓包找寻数据的位置
# 找到数据改怎么办？

import requests

url = 'https://fanyi.baidu.com/v2transapi'
headers = {
    'Acs-Token': '1673251572751_1673271157765_g/6mSzLifSgrvS9aigTiHRYmDw36XKiG++ojk2cz7o0ahzFoX7PBhrB4Bky+B4nToDzvkZjYzvttA+ZuJnSV1r1yl2HfKkT0pnAtp6dMyT6h/qeEMafeAo/DP0tbXmpAsSisusN/UAR5kNYDEGck2WRE551zcd1K7A2veknPwvgmLxTaEene985aPfFVUuh8j7aGxmkhG8HV+nOT4w+wy+75QAb/76LmgN+dFYXCFOa67mJZKCLEIB3HhdQm2qYPgcJT4uhSirlE/P46/foVF5+oH+CiBqiu8Oeprk9x2Erqs02sGvkL2yM30OXmzV7d',
    'Referer': 'https://fanyi.baidu.com/?aldtype=16047',
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36',
    'Cookie': 'BIDUPSID=754A533E1A4F1B8ACCE56A0F70B49D17; PSTM=1671001337; BAIDUID=6722BFB7E8173E6DFA34BA79F57BF6A2:FG=1; APPGUIDE_10_0_2=1; REALTIME_TRANS_SWITCH=1; FANYI_WORD_SWITCH=1; HISTORY_SWITCH=1; SOUND_SPD_SWITCH=1; SOUND_PREFER_SWITCH=1; BA_HECTOR=a5al808ka004a581a10021c31hrnv1l1k; ZFY=YrOwQ0OwcNuj1jEBuS36lvPVwCKwsIMpIKSFxxTEWdg:C; BAIDUID_BFESS=6722BFB7E8173E6DFA34BA79F57BF6A2:FG=1; BDRCVFR[Qs-Y_7gNldt]=OjjlczwSj8nXy4Grjf8mvqV; delPer=0; PSINO=6; BDRCVFR[t1epCe_UAtt]=OjjlczwSj8nXy4Grjf8mvqV; H_PS_PSSID=26350; BDORZ=FFFB88E999055A3F8A630C64834BD6D0; Hm_lvt_64ecd82404c51e03dc91cb9e8c025574=1673263234,1673270127; Hm_lpvt_64ecd82404c51e03dc91cb9e8c025574=1673271151; ab_sr=1.0.1_Njc4MjhkY2IxNTU5NWRhY2I2NjVmMzM1NmZmNWI3MDhlZThmMGE1N2FjNTI3OGRiNTg4Mzk5NTkwM2NhZmM5NDI3M2JkNzQ1ZjBhZThkNDhjNzM4N2IyZDMzZTMzNTViYzBiMzIwNjViMGZkNDAzYTNiNzY1ZmVkMDFhM2Y0YTU5NjAxM2MxZWI5ODUxOTI5OTM5ZjIxOTI2YjUxYjMzNw==',
}

data = {
'from': 'zh',
'to': 'en',
'query': '香蕉',
'transtype': 'realtime',
'simple_means_flag': '3',
'sign': '816986.562283',
'token': 'fdd69a7c544421a1202958c3fcdbcef5',
'domain': 'common',
}

html = requests.post(url, data=data, headers=headers)
print(html.json())

